package com.irs.controller;

import com.irs.pojo.BuildingUtil;
import com.irs.pojo.BusinessDemo;
import com.irs.service.BusinessDemoService;
import com.irs.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class BusinessDemoController {
    @Autowired
    private BusinessDemoService businessDemoService;
    //界面跳转
    @GetMapping("service/notie")//数据库中的href
    public String goBuildingDemo() {

        return "page/demo/businessDemo";
    }

    @GetMapping("/business/demo/list")//与url一致
    @ResponseBody
    public Object villageList() {
        List<BusinessDemo> businessDemoList = businessDemoService.select(new BusinessDemo());
        //返回JSON
        return  ResultUtil.ok(businessDemoList,businessDemoList.size());
    }
}
